import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      home: new MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({required this.title}) : super();

  final String title;

  @override
  _MyHomePageState createState() => new _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  List<Map> imgList = [
    {"url": "images/123.png"},


  ];

  @override
  Widget build(BuildContext context) {
    return new Scaffold(

      body: new Swiper(
          itemBuilder: (BuildContext context, int index) {
            return Container(
                // width: 300,
                child: AspectRatio(
                    aspectRatio: 4.0 / 3.0,
                    // child: Image.network(
                    //   imgList[index]["url"],
                    //   fit: BoxFit.cover,
                    // )));
                    child: Image(
                      image:AssetImage(imgList[index]["url"]),
                      fit: BoxFit.contain,
                    )));
          },
          itemCount: imgList.length,
          // pagination: new SwiperPagination(),
          // //下面的分页小点
          loop: true,
          autoplay: false,
          autoplayDelay:8000,
//        control: new SwiperControl(),  //左右的那个箭头,在某模拟器中会出现蓝线
          ),
    );
  }
}
